﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ANDON_StopLineRateTime.aspx.cs" Inherits="SaicMotor.ANDON_StopLineRateTime" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link href="js_css/bootstrap/css/bootstrap.css" rel="stylesheet" />
    <link href="js_css/bootstrap/css/bootstrap-theme.css" rel="stylesheet" />
    <link href="js_css/bootstrap/css/bootstrap-select.css" rel="stylesheet" />
    <script src="js_css/js/jquery-3.2.1.js"></script>
    <script src="js_css/bootstrap/js/bootstrap.js"></script>
    <script src="js_css/bootstrap/js/bootstrap-select.js"></script>
    <script type="text/javascript" src="/js_css/FusionCharts/FusionCharts.js"></script>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>工位停线频次与时间</title>
</head>
<body>
    <form id="form1" runat="server">
        <div class="col-xs-3">
            <label class="control-label" for="Line">生产线</label>
            <select id="ddlLine" class="selectpicker" data-live-search="true" title="请选择生产线">
                <option value="手工预清理">手工预清理</option>
                <option value="涂胶线">涂胶线</option>
                <option value="涂胶准备">涂胶准备</option>
                <option value="电泳打磨">电泳打磨</option>
                <option value="精修检查">精修检查</option>
                <option value="报交喷蜡">报交喷蜡</option>
            </select>
        </div>
        <div class="col-xs-4">
            <div class="input-group">
                <span class="input-group-addon" id="开始时间">开始时间</span>
                <div class="input-daterange input-group" id="datepicker">
                    <input type="text" class="form-control" name="start" id="txtBeginTime" placeholder="2017-04-30" value="2017-04-01" />
                    <span class="input-group-addon">至</span>
                    <input type="text" class="form-control" name="end" id="txtEndTime" placeholder="2017-05-30" value="2017-06-20" />
                </div>
            </div>
        </div>
        <div class="col-xs-2 ">
            <div class="input-group">
                <span class="input-group-btn">
                    <button type="button" class="btn btn-info btn-search" onclick="GetData();">搜索</button>
                </span>
            </div>
        </div>
    </form>
     <script type="text/javascript">
        function GetData() {
            var _Line = $("#ddlLine").val();
            if (_Line == undefined || _Line == "") {
                alert("请先选择工位，再查看图表！");
                return;
            }
            var _Width = 700;
            var _ChartsType = $("#hfChartsType").val();
            var _ChartsData = "";
            //多层柱状图
            var _RequestType = "GetXMLOfColumn";
            //单层饼状图
            if (_ChartsType == "Pie2D.swf")
                _RequestType = "GetXMLOfPie";
            $.ajax({
                type: "post",
                url: "/SaicMotor.asmx",
                data: {
                    action: "ANDON_StopLineRateTime",
                    RequestType: _RequestType,
                    XFieldName: "Station",
                    XFieldList: _Line,
                    XTypeFieldName: "Rate",
                    XTypeFieldNameLabel: "频次",
                    ChartType: _ChartsType,
                    ChartTitle: "工位频次统计",
                    ChartStyle: 0,

                    Line: $("#ddlLine").val(),
                    BeginTime: $("#txtBeginTime").val(),
                    EndTime: $("#txtEndTime").val(),
                },
                dataType: "text",
                async: false,
                success: function (data) {
                    _ChartsData = data;
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    alert(errorThrown);
                }
            });

            var _Chart1 = new FusionCharts("/js_css/FusionCharts/" + _ChartsType + "?ChartNoDataText=无相关数据", Math.random().toString().substring(3, 6), _Width, "350", false, true);
            _Chart1.setDataXML(_ChartsData);
            _Chart1.render("DivChart");

            $.ajax({
                type: "post",
                url: "/ANDON_StopLineRateTime.aspx",
                data: {
                    action: "ANDON_StopLineRateTime2",
                    RequestType: _RequestType,
                    XFieldName: "Station",
                    XFieldList: _Line,
                    XTypeFieldName: "TimeDiff",
                    XTypeFieldNameLabel: "时间",
                    ChartType: _ChartsType,
                    ChartTitle: "工位时间统计",
                    ChartStyle: 1,

                    Line: $("#ddlLine").val(),
                    BeginTime: $("#txtBeginTime").val(),
                    EndTime: $("#txtEndTime").val(),
                },
                dataType: "text",
                async: false,
                success: function (data) {
                    _ChartsData = data;
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    alert(errorThrown);
                }
            });

            var _Chart2= new FusionCharts("/js_css/FusionCharts/" + _ChartsType + "?ChartNoDataText=无相关数据", Math.random().toString().substring(3, 6), _Width, "350", false, true);
            _Chart2.setDataXML(_ChartsData);
            _Chart2.render("DivChart2");
        }
    </script>
</body>
</html>
